<?php
define( 'DS' , DIRECTORY_SEPARATOR );
define( 'APP_ROOT' ,  dirname( dirname( __FILE__ )  ) . DS );

define( 'BLAB_ROOT' , dirname( __FILE__ ) . DS  );
define( 'LP3K_ROOT' , APP_ROOT.'lp3k'.DS  );

// include_once KIS_APP_ROOT.'ext_lib'. DS.'comm.function.php';
define( 'AROOT' , LP3K_ROOT.'php'.DS);
define( 'CROOT' , AROOT.'_lp'. DS.'core'. DS  );
require_once CROOT. 'lib'.DS.'core.function.php';

require_once 'config.php';
require_once 'incl/main.inc';

dbconnect(); $settings=get_settings(0); $options=get_options();


if(isset($_POST['uid']) && isset($_POST['ups']) && hsh($_POST['uid'].'hash_check')==$_POST['ups']){
	$uid=(int)$_POST['uid']; 
	$query='DELETE FROM '.$dbss['prfx']."_online WHERE usr_id=$uid";
	neutral_query($query); 
	redirect('login.php'); 
	die();
}


if(isset($_GET['url'])){$url=(int)$_GET['url'];}else{$url=0;}
if(isset($_GET['acceptcookies'])){setcookie('acceptcookies','1',time()+3600*24*365,'/');}

switch($url){
case 1: $url='login.php';break;
case 2: $url='register.php';break;
case 3: $url='password.php';break;
case 5: $url='join_world.php';break;
default: $url='homepage.php';break;}

if(isset($_GET['lang'])){
	$gl=(int)$_GET['lang'];
	include 'lang/languages.inc';
	if(is_file('lang/'.$lang_files[$gl])){
	$options[0]=$gl;
	$options=implode('z',$options);
	setcookie('blab8_options',$options,time()+3600*24*365,'/');
	redirect($url);die();}
}

if(isset($_GET['veff'])){
	$vf=(int)$_GET['veff'];
	if($vf<2){$options[3]=$vf;
	$options=implode('z',$options);
	setcookie('blab8_options',$options,time()+3600*24*365,'/');
	redirect($url);die();}
}

if(!isset($_COOKIE['blab8_xuidc'])){
	redirect('login.php');die();
}

redirect($url);
?>